home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / prolog / ai.prl / mike1.exe / TRUCKS.KB < prev    next >
Encoding:
Text File  |  1990-07-11  |  1.6 KB  |  70 lines

  1. /* TRUCKS.KB */
  2. /* Paul Harmon example from Expert System Strategies, Vol. 5, No. 12 Dec. '89 */
  3.  
  4. /* This knowledge base represents a set of trucks and drivers.
  5. The rule (there is just one!)
  6. uses pattern-matching to allocate available drivers to available trucks,
  7. and adds the solutions as list-pairs into working memory.
  8. Harmon uses this example to test whether an expert shell has true
  9. pattern-matching (MIKE does).  To run, toggle on tracing option number 5 via
  10.     ?- tracing(5).
  11. and invoke the forward chainer via
  12.     ?- fc.
  13.  
  14. */
  15.  
  16.  
  17.  
  18. driver1 instance_of driver with
  19.   name: bill,
  20.   status: available,
  21.   city: la.
  22.  
  23. driver2 instance_of driver with
  24.   name: steve,
  25.   status: unavailable,
  26.   city: sf.
  27.  
  28. driver3 instance_of driver with
  29.   name: marge,
  30.   status: available,
  31.   city: sf.
  32.  
  33. driver4 instance_of driver with
  34.   name: lee,
  35.   status: available,
  36.   city: la.
  37.  
  38. truck1 instance_of truck with
  39.   license: 542328,
  40.   status: available,
  41.   city: la.
  42.  
  43. truck2 instance_of truck with
  44.   license: 776343,
  45.   status: available,
  46.   city: la.
  47.  
  48. truck3 instance_of truck with
  49.   license: 115444,
  50.   status: available,
  51.   city: sf.
  52.  
  53. truck4 instance_of truck with
  54.   license: 203300,
  55.   status: unavailable,
  56.   city: on_road.
  57.  
  58. rule demo forward
  59.   if
  60.     Driver instance_of driver &
  61.     Truck instance_of truck &
  62.     the status of Driver is available &
  63.     the status of Truck is available &
  64.     the city of Driver is City &
  65.     the city of Truck is City
  66.   then
  67.     add [Driver, Truck] &
  68.     note the status of Driver is unavailable &
  69.     note the status of Truck is unavailable.
  70.